package com.jf.blog.controller;

import com.jf.blog.bean.Userinfo;
import com.jf.blog.service.UserinfoService;
import com.jf.blog.util.ResultJson;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author JF
 * @since 2025-06-20
 */
@RestController
@RequestMapping("/userinfo")
@Api(tags = "用户模块")
public class UserinfoController {
    @Autowired
    private UserinfoService userinfoService;
    @Autowired
    private StringRedisTemplate redisTemplate;

    @GetMapping("/list")
    @ApiOperation("查询全部")
    public ResultJson list() {

        String code = redisTemplate.opsForValue().get("kaptcha-1234");
        System.out.println(code);

        List<Userinfo> list = userinfoService.list();
        return ResultJson.success(list);
    }
}
